package com.xjl.service.impl;

import java.io.IOException;

import com.xjl.dao.GoodsDao;
import com.xjl.dao.impl.GoodsDaoImpl;
import com.xjl.demo.PageInfo;
import com.xjl.service.GoodsService;

public class GoodsServiceImpl implements GoodsService {

	GoodsDao gd = new GoodsDaoImpl();
	//分页查询所有商品信息
	public PageInfo showPage(int pageSize, int pageNumber) throws IOException {
		
		PageInfo pi = new PageInfo();
		pi.setPageNumber(pageNumber);
		pi.setPageSize(pageSize);
	
		pi.setList(gd.QueryAllGoods(pageSize*(pageNumber-1), pageSize));
		//总条数
		long count = gd.CountGoodsDao();
		
		pi.setTotal(count%pageSize==0?count/pageSize:count/pageSize+1);
		return pi;
	}
	

}
